 import {createBrowserRouter,Navigate} from 'react-router-dom'
import Main from '../pages/main'
import Home from '../pages/home'
import Mall from '../pages/mall'
import User from '../pages/user'
import PageOne from '../pages/other/pageOne'
import PageTwo from '../pages/other/pageTwo'

 const routes = [
        {
        path: '/',
        Component:Main,
        // 注意，Main当中要放一个children的出口，否则显示不出
        children: [
            // 重定向
            {
              path: '/',
              element:<Navigate to="home" replace></Navigate>
            },
             {
                path: 'home',
                Component:Home
             },
             {
                path: 'mall',
                Component:Mall
             },
             {
                path: 'user',
                Component:User
             },
             {
                path: 'other',
                children: [
                    {
                        path: 'pageOne',
                        Component:PageOne
                    },
                    {
                        path: 'PageTwo',
                        Component:PageTwo
                    }
                ]
             }
        ]
    
        }
 ]
 export default createBrowserRouter(routes);